// DrawLine.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "JHZk.h"
#include "JHSerialPort.h"

#pragma comment(lib, "..\\..\\Lib\\jinhanzk.lib")


int _tmain(int argc, _TCHAR* argv[])
{
	HANDLE hdl;
	JHINFO_SERIALPORT JHInfo_serialport;
	int ret;

	/* Create instance */
	JHCreateInst(&hdl, 0);
	if (NULL == hdl)
	{
		printf("\nFailure to create instance!\n");
		return -1;
	}

	/* Communication mode and parameters setting */
	JHInfo_serialport.size = sizeof(JHINFO_SERIALPORT);
	memcpy(JHInfo_serialport.serialport, "COM1", 5);
	JHInfo_serialport.baudrate = 115200;
	JHInfo_serialport.databits = 8;
	JHInfo_serialport.parity = 0;
	JHInfo_serialport.stopbits = 0;
	JHInfo_serialport.reserved = 0;
	JHInfo_serialport.timeout = 5000;
	JHMountTransportLayer(hdl, &JHTransportlayer_serialport, (const void *)(&JHInfo_serialport));

	/* Draw line operation*/
	JHZRESULT res = JHDrawLine(hdl, 0, 0, 0, 15);
	if (JR_OK == res)
	{
		printf("\nSuccessed in drawing line!\n");
		ret = 0;
	}
	else
	{
		printf("\nFailure to draw Line!\n");
		ret = -1;
	}

	/* Delete instance */
	JHDeleteInst(hdl);

	system("pause");

	return ret;
}

